/* jshint indent: 1 */

module.exports = function(sequelize, DataTypes) {
	return sequelize.define('teacher', {
		tea_id: {
			type: DataTypes.INTEGER,
			allowNull: false,
			primaryKey: true
		},
		name: {
			type: DataTypes.STRING(255),
			allowNull: false
		},
		password: {
			type: DataTypes.STRING(255),
			allowNull: true
		},
		age: {
			type: DataTypes.INTEGER,
			allowNull: false
		},
		sex: {
			type: DataTypes.STRING(2),
			allowNull: true
		},
		college_id: {
			type: DataTypes.INTEGER,
			allowNull: true,
			references: {
				model: {
					tableName: 'college',
				},
				key: 'college_id'
			}
		}
	}, {
		sequelize,
		tableName: 'teacher',
		timestamps: false
	});
};
